public class testOpportunityandaccount {

public Set<Id> oppidlist{get;set;}
public List<Account> acclist{get;set;}
    public testOpportunityandaccount()
      {
       acclist=[select id,name,(Select id ,name from Opportunities) from Account];
       oppidlist=new set<Id>();
           for(Account a:acclist)
            {
                 if(!a.Opportunities.isEmpty())
                  {
                      oppidlist.add(a.Id);
                      for(Opportunity opp: a.Opportunities)
                      
                      {
                          //oppidlist.add(Opp.Id);
                      }
                  }
                  //oppidlist.add(a.Name);
            }      
        
      
      }
}